﻿using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Syndication;
using System.ServiceModel.Web;
using SimpleServiceBus.EndpointManagement.Wcf.Contracts.Data;
using SimpleServiceBus.EndpointManagement.Wcf.Contracts.Data.Analytics;

namespace SimpleServiceBus.EndpointManagement.Wcf.Contracts.Operation
{
    [ServiceKnownType(typeof(Atom10FeedFormatter))]
    [ServiceKnownType(typeof(Rss20FeedFormatter))]
    [ServiceContract]
    public interface IEndpointManagementWebService
    {
        [OperationContract, WebGet(UriTemplate="Endpoints/{endpointId}/")]
        ManagedEndpointContract GetEndpoint(string endpointId);
        

        [OperationContract, WebGet(UriTemplate = "Endpoints/")]
        List<ManagedEndpointContract> GetAllEndpoints();


        [OperationContract, WebGet(UriTemplate = "Endpoints.{format}")]
        SyndicationFeedFormatter GetAllEndpointsFeed(string format);

        [OperationContract, WebGet(UriTemplate = "Endpoints/{endpointId}/Errors/?maxResults={maxResults}")]
        List<EndpointErrorContract> GetEndpointErrorsByEndpointId(string endpointId, int maxResults);

        [OperationContract, WebGet(UriTemplate = "Endpoints/{endpointId}/PerformanceSummaries/?maxResults={maxResults}")]
        List<EndpointPerformanceSummaryContract> GetEndpointPerformanceSummaries(string endpointId, int maxResults);

        [OperationContract, WebGet(UriTemplate = "Errors/{errorId}/")]
        EndpointErrorContract GetEndpointError(string errorId);

        [OperationContract, WebGet(UriTemplate = "Errors/?maxResults={maxResults}")]
        List<EndpointErrorContract> GetEndpointErrors(int maxResults);

        [OperationContract, WebGet(UriTemplate = "Errors.{format}")]
        SyndicationFeedFormatter GetEndpointErrorsFeed(string format);

        [OperationContract,
         WebGet(
             UriTemplate =
                 "Endpoints/{endpointId}/PerformanceSummaries/TimeSeriesQuery/?metrics={metricList}&startTime={startTime}&endTime={endTime}"
             )]
        TimeSeriesContract TimeSeriesQuery(string endpointId,string metricList, DateTime startTime, DateTime endTime);


    }
}
